using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.Serialization;

namespace Bookvar.ObjectModel
{
    /// <summary>
    /// An attachment to a topic. An attachment can be a local file, a web page, etc.
    /// </summary>
    [DataContract]
    [Serializable]
    public class Attachment : IFileResource
    {
        [DataMember(Name = "ID")]
        private readonly Guid id;

        private string fileName;
        
        [DataMember]
        public string FileName
        {
            get { return fileName; }
            set { fileName = value; }
        }

        [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "ID")]
        public Guid ID
        {
            get { return id; }
        }

        public FileResourceType FileResourceType
        {
            get { return FileResourceType.Attachment; }
        }

        public Attachment(Guid id, string fileName)
        {
            this.id = id;
            this.fileName = fileName;
        }

        public Attachment( string fileName ) : this( Guid.NewGuid(), fileName )
        {
        }

        public Attachment() : this( string.Empty )
        {
        }
    }
}
